<%-- 
    Document   : obtener-carpetas-origen
    Created on : 10/09/2010, 01:09:47 PM
    Author     : Eduardo
--%>
<%@page contentType="text/html" pageEncoding="UTF-8"%>
<%@page import="java.util.*" %>
<%@page import="java.io.*" %>

<%@taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%
    Properties prop = new Properties();
    FileInputStream in = new FileInputStream(application.getRealPath("/WEB-INF/classes/pe/gob/pnp/digitalizar/config.properties"));
    prop.load(in);
    String carpetaOrigen = prop.getProperty("carpetaImagenes");
    session.setAttribute("carpetaImagenes", carpetaOrigen);
    in.close();
    File[] carpetas = new File(carpetaOrigen).listFiles();
    pageContext.setAttribute("carpetas", carpetas);
%>
<c:set var="i" value="0"/>
{
    carpetas:
    [
<c:forEach var="carpeta" items="${carpetas}">
    <c:if test="${carpeta.directory}">
        ${i>0 ? "," : ""}
        {
            nombre: "${carpeta.name}"
        }
        <c:set var="i" value="${i+1}"/>
    </c:if>
</c:forEach>

    ]
}
